package com.dingding.common.core.config;

import org.apache.log4j.Logger;

/**
 * 
 * @ClassName: SendMsgConfig 
 * @Description: 消息队列相关配置
 * @author CHEHAUNBO 
 * @date 2016年5月27日 下午2:54:06
 * 
 */
public class MessageQueueConfig extends AbstractConfig {

	private Logger log = Logger.getLogger(SendMsgConfig.class);

	// 消息队列环境
	private static String MESSAGE_QUEUE_ENV = "produce";

	// 推送消费者ID，默认为生产环境
	private static String MESSAGE_QUEUE_PUSH_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_PUSH_CONSUMERID;
	private static String MESSAGE_QUEUE_EMAIL_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_EMAIL_CONSUMERID;
	private static String MESSAGE_QUEUE_BIZ_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_BIZ_CONSUMERID;
	private static String MESSAGE_QUEUE_APPOINT_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_APPOINT_CONSUMERID;
	private static String MESSAGE_QUEUE_MSG_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_MSG_CONSUMERID;
	private static String MESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_APPOINT_TAXI_CONSUMERID;
	private static String MESSAGE_QUEUE_NETTY_PUSH_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_NETTY_PUSH_CONSUMERID;

	// 生产者ID，默认为生产环境
	private static String MESSAGE_QUEUE_PRODUCEID = Constants.MESSAGE_QUEUE_PRO_PRODUCEID;

	// 消息队列订阅主题，默认为生产环境
	private static String MESSAGE_QUEUE_TOPIC = Constants.MESSAGE_QUEUE_PRODUCE_TOPIC;

	/**
	 * 初始化消息队列配置
	 * @Title: intitalConfigValue 
	 * @author CHEHAUNBO
	 * 
	 */
	@Override
	public void intitalConfigValue() {

		String flag = prop.get("env_message_queue");
		
		if ("dev".equals(flag)) { // 开发环境
			MESSAGE_QUEUE_PUSH_CONSUMERID = Constants.MESSAGE_QUEUE_DEV_PUSH_CONSUMERID;
			MESSAGE_QUEUE_EMAIL_CONSUMERID=Constants.MESSAGE_QUEUE_DEV_EMAIL_CONSUMERID;
			MESSAGE_QUEUE_BIZ_CONSUMERID=Constants.MESSAGE_QUEUE_DEV_BIZ_CONSUMERID;
			MESSAGE_QUEUE_APPOINT_CONSUMERID=Constants.MESSAGE_QUEUE_DEV_APPOINT_CONSUMERID;
			MESSAGE_QUEUE_MSG_CONSUMERID = Constants.MESSAGE_QUEUE_DEV_MSG_CONSUMERID;
			MESSAGE_QUEUE_PRODUCEID = Constants.MESSAGE_QUEUE_DEV_PRODUCEID;
			MESSAGE_QUEUE_TOPIC = Constants.MESSAGE_QUEUE_DEV_TOPIC;
			setMESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID(Constants.MESSAGE_QUEUE_DEV_APPOINT_TAXI_CONSUMERID);
			setMESSAGE_QUEUE_NETTY_PUSH_CONSUMERID(Constants.MESSAGE_QUEUE_DEV_NETTY_PUSH_CONSUMERID);
			MESSAGE_QUEUE_ENV = "dev";
		} else if ("test".equals(flag)) { // 测试环境
			MESSAGE_QUEUE_PUSH_CONSUMERID = Constants.MESSAGE_QUEUE_TEST_PUSH_CONSUMERID;
			MESSAGE_QUEUE_EMAIL_CONSUMERID=Constants.MESSAGE_QUEUE_TEST_EMAIL_CONSUMERID;
			MESSAGE_QUEUE_BIZ_CONSUMERID=Constants.MESSAGE_QUEUE_TEST_BIZ_CONSUMERID;
			MESSAGE_QUEUE_APPOINT_CONSUMERID=Constants.MESSAGE_QUEUE_TEST_APPOINT_CONSUMERID;
			MESSAGE_QUEUE_MSG_CONSUMERID = Constants.MESSAGE_QUEUE_TEST_MSG_CONSUMERID;
			MESSAGE_QUEUE_PRODUCEID = Constants.MESSAGE_QUEUE_TEST_PRODUCEID;
			MESSAGE_QUEUE_PRODUCEID = Constants.MESSAGE_QUEUE_TEST_PRODUCEID;
			MESSAGE_QUEUE_TOPIC = Constants.MESSAGE_QUEUE_TEST_TOPIC;
			setMESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID(Constants.MESSAGE_QUEUE_TEST_APPOINT_TAXI_CONSUMERID);
			setMESSAGE_QUEUE_NETTY_PUSH_CONSUMERID(Constants.MESSAGE_QUEUE_TEST_NETTY_PUSH_CONSUMERID);
			MESSAGE_QUEUE_ENV = "test";
		}else{		//如果是正式环境
			MESSAGE_QUEUE_PUSH_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_PUSH_CONSUMERID;
			MESSAGE_QUEUE_EMAIL_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_EMAIL_CONSUMERID;
			MESSAGE_QUEUE_BIZ_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_BIZ_CONSUMERID;
			MESSAGE_QUEUE_APPOINT_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_APPOINT_CONSUMERID;
			MESSAGE_QUEUE_MSG_CONSUMERID = Constants.MESSAGE_QUEUE_PRO_MSG_CONSUMERID;
			MESSAGE_QUEUE_PRODUCEID = Constants.MESSAGE_QUEUE_PRO_PRODUCEID;
			MESSAGE_QUEUE_TOPIC = Constants.MESSAGE_QUEUE_PRODUCE_TOPIC;
			setMESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID(Constants.MESSAGE_QUEUE_PRO_APPOINT_TAXI_CONSUMERID);
			setMESSAGE_QUEUE_NETTY_PUSH_CONSUMERID(Constants.MESSAGE_QUEUE_PRO_NETTY_PUSH_CONSUMERID);
		}

		log.info("正在初始化消息队列环境！初始化后的值为：" + this.toString());

	}

	public static String getMESSAGE_QUEUE_ENV() {
		return MESSAGE_QUEUE_ENV;
	}

	public static void setMESSAGE_QUEUE_ENV(String mESSAGE_QUEUE_ENV) {
		MESSAGE_QUEUE_ENV = mESSAGE_QUEUE_ENV;
	}

	

	public static String getMESSAGE_QUEUE_PUSH_CONSUMERID() {
		return MESSAGE_QUEUE_PUSH_CONSUMERID;
	}

	public static void setMESSAGE_QUEUE_PUSH_CONSUMERID(String mESSAGE_QUEUE_PUSH_CONSUMERID) {
		MESSAGE_QUEUE_PUSH_CONSUMERID = mESSAGE_QUEUE_PUSH_CONSUMERID;
	}

	public static String getMESSAGE_QUEUE_EMAIL_CONSUMERID() {
		return MESSAGE_QUEUE_EMAIL_CONSUMERID;
	}

	public static void setMESSAGE_QUEUE_EMAIL_CONSUMERID(String mESSAGE_QUEUE_EMAIL_CONSUMERID) {
		MESSAGE_QUEUE_EMAIL_CONSUMERID = mESSAGE_QUEUE_EMAIL_CONSUMERID;
	}

	public static String getMESSAGE_QUEUE_BIZ_CONSUMERID() {
		return MESSAGE_QUEUE_BIZ_CONSUMERID;
	}

	public static void setMESSAGE_QUEUE_BIZ_CONSUMERID(String mESSAGE_QUEUE_BIZ_CONSUMERID) {
		MESSAGE_QUEUE_BIZ_CONSUMERID = mESSAGE_QUEUE_BIZ_CONSUMERID;
	}

	public static String getMESSAGE_QUEUE_APPOINT_CONSUMERID() {
		return MESSAGE_QUEUE_APPOINT_CONSUMERID;
	}

	public static void setMESSAGE_QUEUE_APPOINT_CONSUMERID(String mESSAGE_QUEUE_APPOINT_CONSUMERID) {
		MESSAGE_QUEUE_APPOINT_CONSUMERID = mESSAGE_QUEUE_APPOINT_CONSUMERID;
	}

	public static String getMESSAGE_QUEUE_TOPIC() {
		return MESSAGE_QUEUE_TOPIC;
	}

	public static void setMESSAGE_QUEUE_TOPIC(String mESSAGE_QUEUE_TOPIC) {
		MESSAGE_QUEUE_TOPIC = mESSAGE_QUEUE_TOPIC;
	}

	public static String getMESSAGE_QUEUE_PRODUCEID() {
		return MESSAGE_QUEUE_PRODUCEID;
	}

	public static void setMESSAGE_QUEUE_PRODUCEID(String mESSAGE_QUEUE_PRODUCEID) {
		MESSAGE_QUEUE_PRODUCEID = mESSAGE_QUEUE_PRODUCEID;
	}
	
	

	public static String getMESSAGE_QUEUE_MSG_CONSUMERID() {
		return MESSAGE_QUEUE_MSG_CONSUMERID;
	}

	public static void setMESSAGE_QUEUE_MSG_CONSUMERID(String mESSAGE_QUEUE_MSG_CONSUMERID) {
		MESSAGE_QUEUE_MSG_CONSUMERID = mESSAGE_QUEUE_MSG_CONSUMERID;
	}

	public String toString() {
		return "队列环境：" + MESSAGE_QUEUE_ENV + "[MESSAGE_QUEUE_CONSUMERID:]" + MESSAGE_QUEUE_PUSH_CONSUMERID
				+ "[MESSAGE_QUEUE_PRODUCEID:]" + MESSAGE_QUEUE_PRODUCEID + "[MESSAGE_QUEUQ_TOPIC:]"
				+ MESSAGE_QUEUE_TOPIC;
	}

	public static String getMESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID() {
		return MESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID;
	}

	public static void setMESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID(String mESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID) {
		MESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID = mESSAGE_QUEUE_APPOINT_TAXI_CONSUMERID;
	}

	public static String getMESSAGE_QUEUE_NETTY_PUSH_CONSUMERID() {
		return MESSAGE_QUEUE_NETTY_PUSH_CONSUMERID;
	}

	public static void setMESSAGE_QUEUE_NETTY_PUSH_CONSUMERID(String mESSAGE_QUEUE_NETTY_PUSH_CONSUMERID) {
		MESSAGE_QUEUE_NETTY_PUSH_CONSUMERID = mESSAGE_QUEUE_NETTY_PUSH_CONSUMERID;
	}

}
